﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// “用户控件”项模板在 http://go.microsoft.com/fwlink/?LinkId=234236 上提供

namespace WeixinSB.Control
{
    public sealed partial class CheckedControl : UserControl
    {


        public bool IsChecked
        {
            get { return (bool)GetValue(IsCheckedProperty); }
            set { SetValue(IsCheckedProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IsChecked.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsCheckedProperty =
            DependencyProperty.Register("IsChecked", typeof(bool), typeof(CheckedControl), new PropertyMetadata(true));



        public CheckedControl()
        {
            this.InitializeComponent();
        }

        private void Checked_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var p = sender as Windows.UI.Xaml.Shapes.Path;
            if (p != null)
            {
                if (IsChecked)
                {
                    //cccccc
                    p.Fill = new SolidColorBrush(Color.FromArgb(255, 0xcc, 0xcc, 0xcc));
                    IsChecked = false;
                }
                else
                {
                    //e85946
                    p.Fill = new SolidColorBrush(Color.FromArgb(255, 0xe8, 0x59, 0x46));
                    IsChecked = true;
                }
            }
        }
    }
}
